<%@ page import="dao.GoodDao" %>
<%@ page import="po.Good" %>
<%@ page import="dao.impl.GoodDaoImpl" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="resources/css/amazeui.min.css">
    <link rel="stylesheet" href="resources/css/admin.css">
    <link rel="stylesheet" href="resources/css/app.css">
    <style>
        .admin-main {
            padding-top: 0;
        }
        .am-form-group{
            width: 200px; margin: 0 auto;
        }
    </style>
</head>
<%
    String goodid = request.getParameter("goodid");
    String warehouseId=request.getParameter("warehouseId");
    GoodDao dao = new GoodDaoImpl();
    Good good = dao.getGood(goodid);
%>
<body>
<div class="am-cf admin-main">
    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-g">
                <form class="am-form am-form-horizontal" action=exWarehouseProcessing.jsp?goodid=<%=good.getGoodId()%>&warehouseId=<%=warehouseId%> method="post"
                      style="padding-top:30px;" data-am-validator name="form1">
                    <div class="am-form-group">
                        <h3>输入出库的<%=good.getGoodName()%>信息：</h3>
                    <div class="am-form-group">
                        <label>
                            <input type="text" name="count" placeholder="出库数量" >
                        </label>
                    </div>
                    <br>
                    <div class="am-form-group">
                        <label>
                            <input type="text" name="shipper" placeholder="货主" >
                        </label>
                    </div>
                    <br>
                    <div class="am-form-group">
                        <div class="am-u-sm-9 am-u-sm-push-3">
                            <input type="submit" class="am-btn am-btn-success" value="出库" onclick="return checkForm()"/>
                        </div>
                    </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function checkForm() {
        const count = form1.count.value;
        const shipper = form1.shipper.value;
        //alert(name + pwd + repwd);
        if (count === "" || count == null) {
            alert("请输入出库数量");
            form1.count.focus();
            return false;
        } else if (shipper === "" || shipper == null) {
            alert("请输入货主名字");
            form1.shipper.focus();
            return false;
        } else if (count><%=good.getCount()%>) {
            alert('货物数量不足，请重新选择数量');
            form1.count.focus();
            return false;
        }
        alert("出库成功");
        return true;

    }
</script>
<script type="text/javascript" src="resources/js/jquery-1.10.2.min.js">
</script>
<script type="text/javascript" src="resources/js/plugs.js">
</script>
</body>
</html>
